﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Interfaz
{
    /// <summary>
    /// Interaction logic for InicioAdministrador.xaml
    /// </summary>
    public partial class InicioAdministrador : UserControl
    {
        public InicioAdministrador()
        {
            InitializeComponent();
            this.AddHandler(CloseableTabItem.CloseTabEvent, new RoutedEventHandler(this.CloseTab));
        
        }
        private void CloseTab(object source, RoutedEventArgs args)
        {
            TabItem tabItem = args.Source as TabItem;
            if (tabItem != null)
            {
                TabControl tabControl = tabItem.Parent as TabControl;
                if (tabControl != null)
                    tabControl.Items.Remove(tabItem);
            }
        }
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            TabItem item = new CloseableTabItem();
            item.Header = "Registro usuario";
            item.Content = new Registrar();
            Tab1.Items.Add(item);
            Tab1.SelectedIndex = Tab1.Items.Count - 1;
        }
    }
}
